package com.huobao.yunying.adapters;

import com.huobao.yunying.entity.SearchProgectList;
import com.huobao.yunying.utils.ImageUtils;
import com.huobao.zhangying.R;

import android.content.Context;
import android.text.TextUtils;
import android.widget.ImageView;
import joanzapata.android.BaseAdapterHelper;
import joanzapata.android.QuickAdapter;

public class Adapter_SearchProgectList extends QuickAdapter<SearchProgectList> {

	private String genre;
	public Adapter_SearchProgectList(Context context) {
		super(context, R.layout.item_search_progect_list);
	}

	@Override
	protected void convert(BaseAdapterHelper helper, SearchProgectList data) {
		ImageView imageview = helper.getView(R.id.imageview);
		ImageUtils.loadimg(imageview, data.default_image);
		if(TextUtils.isEmpty(data.genre) == false && data.genre.equals("3")){
			helper.setVisible(R.id.tv_content, false);
		}else if(data.genre.equals("3") == false){
			helper.setVisible(R.id.tv_content, true);
		}
		helper.setText(R.id.tv_name, data.goods_name).setText(R.id.tv_price, data.genre != null && data.genre.equals("3")?"火爆招商中":"￥" + data.price)
				.setText(R.id.tv_storename, data.store_name).setText(R.id.tv_content, data.goods_text);
	}

	public void setGenre(String genre){
		if(TextUtils.isEmpty(genre))return;
		this.genre = genre;
		notifyDataSetChanged();
	}
}
